/*
 *  Copyright (C) 2011  Clint Priest
 *
 *  This file is part of Snap Graph.
 *
 *  Snap Graph is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Snap Graph is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Snap Graph.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
var SnapGraph = { };
var SnapGraphContext = { };

/* Load all resource files into the SnapGraphContext, SnapGraph is the main global used to reference this extension */

window.addEventListener('load', function() {
//	if(typeof toJavaScriptConsole != 'undefined')
//		toJavaScriptConsole();

	with(SnapGraphContext) {
		/* Loads the pklib globally into this context, this defines a LoadScript() and other utility functions */
		Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
			.getService(Components.interfaces.mozIJSSubScriptLoader)
			.loadSubScript('chrome://SnapGraph/content/pklib/global.js', this);

		LoadScript('chrome://SnapGraph/content/SnapGraph.js');
		
		$A(document.querySelectorAll('bootloader')).forEach( function(elem) {
			LoadScript(elem.getAttribute('src'));
		} );
	}
}, false);